package com.ibeeking.found.open.api.feign;

import com.ibeeking.found.open.api.common.dto.ParkingPlatformDTO;
import com.ibeeking.found.open.api.common.dto.StatisticsCarDTO;
import com.ibeeking.found.open.api.common.dto.TenantParkingInfoDTO;
import com.ibeeking.found.open.api.common.param.ParkingChargeRecordParam;
import com.ibeeking.found.open.api.common.param.ParkingInParam;
import com.ibeeking.found.open.api.common.param.ParkingOrderParam;
import com.ibeeking.found.open.api.common.param.ParkingOutParam;
import com.ibeeking.found.open.api.common.query.ParkingConfigQuery;
import com.ibeeking.found.open.api.common.query.StatisticsCarQuery;
import com.ibeeking.found.open.api.feign.fallback.ParkingFeignFallbackFactory;
import com.ibeeking.nematos.utils.result.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @Author ibeeking
 */
@FeignClient(name = "mall-parking-c-server", path = "/c", contextId = "parkingFeignClient", fallbackFactory = ParkingFeignFallbackFactory.class, decode404 = true)
public interface ParkingFeignClient {

    /**
     * 查询停车场配置信息
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/parking/feign/v1/parkingConfig")
    ResponseResult<ParkingPlatformDTO> parkingConfig(@RequestBody ParkingConfigQuery query);

    /**
     * 入场信息
     *
     * @param params
     * @return
     */
    @PostMapping(value = "/parking/feign/v1/receiveInParkInfo")
    ResponseResult<Boolean> receiveInParkInfo(@RequestBody List<ParkingInParam> params);

    /**
     * 出场信息
     *
     * @param params
     * @return
     */
    @PostMapping(value = "/parking/feign/v1/receiveOutParkInfo")
    ResponseResult<Boolean> receiveOutParkInfo(@RequestBody List<ParkingOutParam> params);

    /**
     * 订单信息
     *
     * @param params
     * @return
     */
    @PostMapping(value = "/parking/feign/v1/receiveParkOrder")
    ResponseResult<Boolean> receiveParkOrder(@RequestBody List<ParkingOrderParam> params);

    /**
     * 查询租户id通过停车场配置
     *
     * @param parkCode
     * @return
     */
    @PostMapping(value = "/parking/feign/v1/queryTenantIdByParkCode/{parkCode}")
    ResponseResult<TenantParkingInfoDTO> queryTenantIdByParkCode(@PathVariable("parkCode") String parkCode);

    /**
     * 收费记录
     *
     * @param params
     * @return
     */
    @PostMapping(value = "/parking/feign/v1/receiveParkCharge")
    ResponseResult<Boolean> receiveParkCharge(@RequestBody List<ParkingChargeRecordParam> params);

    @PostMapping(value = "/parking/feign/v1/statisticsCar")
    ResponseResult<List<StatisticsCarDTO>> statisticsCar(@RequestBody StatisticsCarQuery query);
}
